import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

/* Layout */
import Layout from '@/layout';

export const constantRoutes = [
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect/index')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/qrlogin',
    component: () => import('@/views/login/qrcode'),
    hidden: true
  },
  {
    path: '/auth-redirect',
    component: () => import('@/views/login/auth-redirect'),
    hidden: true
  },
  {
    path: '/404',
    component: () => import('@/views/error-page/404'),
    hidden: true
  },
  {
    path: '/map',
    component: () => import('@/views/error-page/map'),
    hidden: true
  },
  {
    path: '/401',
    component: () => import('@/views/error-page/401'),
    hidden: true
  },
  {
    path: '/channelData',
    component: () => import('@/views/channel/channelData'),
    hidden: true
  },
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [
      {
        path: 'Dashboard',
        component: () => import('@/views/dashboard/index'),
        name: 'Dashboard',
        meta: { title: '看板', icon: 'dashboard', affix: true }
      }
    ]
  }
];

/**
 * asyncRoutes
 * 动态路由
 */
export const asyncRoutes = [
  {
    path: '/dashboard',
    component: Layout,
    name: 'Dashboard',
    redirect: '/dashboard',
    children: [
      {
        path: 'Dashboard',
        component: () => import('@/views/dashboard/index'),
        name: 'Dashboard',
        meta: { title: '看板', icon: 'dashboard', affix: true }
      }
    ]
  },

  // 助贷
  // {
  //   path: '/apiloan',
  //   component: Layout,
  //   redirect: '/',
  //   alwaysShow: true, // will always show the root menu
  //   name: 'apiloan',
  //   meta: {
  //     title: '助贷管理',
  //     icon: 'zhudai_product',
  //     roles: ['super'] // you can set roles in root nav
  //   },
  //   children: [
  // {
  //   path: 'ProcessList',
  //   component: () => import('@/views/loan/process'),
  //   name: 'ProcessList',
  //   meta: {
  //     title: '助贷进度',
  //     roles: ['super']
  //   }
  // },
  // {
  //   path: 'ProcessCountPlatformChannel',
  //   component: () => import('@/views/loan/processcountplatformChannel'),
  //   name: 'ProcessCountPlatformChannel',
  //   meta: {
  //     title: '助贷渠道统计',
  //     roles: ['super']
  //   }
  // },
  // {
  //   path: 'appleOrder',
  //   component: () => import('@/views/loan/appleOrder'),
  //   name: 'appleOrder',
  //   meta: {
  //     title: '申请单查询',
  //     roles: ['super']
  //   }
  // },
  // {
  //   path: 'apiloan',
  //   component: () => import('@/views/loanApps/index'),
  //   name: 'apiloan',
  //   meta: {
  //     title: '助贷产品',
  //     roles: ['super']
  //   },
  //   children: [
  // {
  //   path: '/chuangying',
  //   // component: Layout,
  //   component: () => import('@/views/loanApps/chuangying/index'),
  //   redirect: '/',
  //   alwaysShow: true, // will always show the root menu
  //   name: 'chuangying',
  //   meta: {
  //     title: '创赢',
  //     icon: 'fullscreen',
  //     roles: ['super'] // you can set roles in root nav
  //   },
  //   children: [
  //     {
  //       path: 'chuangyingOrderList',
  //       component: () => import('@/views/loanApps/chuangying/chuangyingOrderList'),
  //       name: 'chuangyingOrderList',
  //       meta: {
  //         title: '订单列表',
  //         roles: ['super']
  //       }
  //     },
  //     {
  //       path: 'chuangyingRepayPlan',
  //       component: () => import('@/views/loanApps/chuangying/chuangyingRepayPlan'),
  //       name: 'chuangyingRepayPlan',
  //       meta: {
  //         title: '还款列表',
  //         roles: ['super']
  //       }
  //     },
  //     {
  //       path: 'chuangyingRepayFlow',
  //       component: () => import('@/views/loanApps/chuangying/chuangyingRepayFlow'),
  //       name: 'chuangyingRepayFlow',
  //       meta: {
  //         title: '还款流水',
  //         roles: ['super']
  //       }
  //     },
  //     {
  //       path: 'chuangyingUserList',
  //       component: () => import('@/views/loanApps/chuangying/chuangyingUserList'),
  //       name: 'chuangyingUserList',
  //       meta: {
  //         title: '用户列表',
  //         roles: ['super']
  //       }
  //     }
  //   ]
  // },
  // {
  //   path: '/creditFly',
  //   // component: Layout,
  //   component: () => import('@/views/loanApps/creditFly/index'),
  //   redirect: '/',
  //   alwaysShow: true, // will always show the root menu
  //   name: 'creditFly',
  //   meta: {
  //     title: '畅行花',
  //     icon: 'fullscreen',
  //     roles: ['super'] // you can set roles in root nav
  //   },
  //   children: [
  //     // {
  //     //   path: 'creditFlyUser',
  //     //   component: () => import('@/views/creditFly/creditFlyUser'),
  //     //   name: 'creditFlyUser',
  //     //   meta: {
  //     //     title: '用户列表',
  //     //     roles: ['super']
  //     //   }
  //     // },
  //     {
  //       path: 'creditFlyReview',
  //       component: () => import('@/views/loanApps/creditFly/creditFlyReview'),
  //       name: 'creditFlyReview',
  //       meta: {
  //         title: '审核列表',
  //         roles: ['super']
  //       }
  //     },
  //     {
  //       path: 'creditFlyLoan',
  //       component: () => import('@/views/loanApps/creditFly/creditFlyLoan'),
  //       name: 'creditFlyLoan',
  //       meta: {
  //         title: '放款列表',
  //         roles: ['super']
  //       }
  //     },
  //     {
  //       path: 'creditFlyOrder',
  //       component: () => import('@/views/loanApps/creditFly/creditFlyOrder'),
  //       name: 'creditFlyOrder',
  //       meta: {
  //         title: '订单列表',
  //         roles: ['super']
  //       }
  //     },
  //     {
  //       path: 'creditDataStatistic',
  //       component: () => import('@/views/loanApps/creditFly/creditDataStatistic'),
  //       name: 'creditDataStatistic',
  //       meta: {
  //         title: '数据统计',
  //         roles: ['super']
  //       }
  //     }
  //   ]
  // },
  // {
  //   path: '/moneyCan',
  //   // component: Layout,
  //   component: () => import('@/views/loanApps/moneyCan/index'),
  //   redirect: '/',
  //   alwaysShow: true, // will always show the root menu
  //   name: 'moneyCan',
  //   meta: {
  //     title: '洋钱罐',
  //     icon: 'fullscreen',
  //     roles: ['super'] // you can set roles in root nav
  //   },
  //   children: [
  //     {
  //       path: 'moneyCanOrder',
  //       component: () => import('@/views/loanApps/moneyCan/moneyCanOrder'),
  //       name: 'moneyCanOrder',
  //       meta: {
  //         title: '订单列表',
  //         roles: ['super']
  //       }
  //     },
  //     {
  //       path: 'moneyCanDataStatistic',
  //       component: () => import('@/views/loanApps/moneyCan/moneyCanDataStatistic'),
  //       name: 'moneyCanDataStatistic',
  //       meta: {
  //         title: '数据统计',
  //         roles: ['super']
  //       }
  //     }
  //   ]
  // },
  // {
  //   path: '/shuyao',
  //   // component: Layout,
  //   component: () => import('@/views/loanApps/shuyao/index'),
  //   redirect: '/',
  //   alwaysShow: true, // will always show the root menu
  //   name: 'shuyao',
  //   meta: {
  //     title: '数钥',
  //     icon: 'fullscreen',
  //     roles: ['super'] // you can set roles in root nav
  //   },
  //   children: [
  //     {
  //       path: 'shuyaoUser',
  //       component: () => import('@/views/loanApps/shuyao/shuyaoUser'),
  //       name: 'shuyaoUser',
  //       meta: {
  //         title: '用户列表',
  //         roles: ['super']
  //       }
  //     },
  //     {
  //       path: 'shuyaoPushUser',
  //       component: () => import('@/views/loanApps/shuyao/shuyaoReview'),
  //       name: 'shuyaoPushUser',
  //       meta: {
  //         title: '推送列表',
  //         roles: ['super']
  //       }
  //     },
  //     {
  //       path: 'shuyaoLoan',
  //       component: () => import('@/views/loanApps/shuyao/shuyaoLoan'),
  //       name: 'shuyaoLoan',
  //       meta: {
  //         title: '放款列表',
  //         roles: ['super']
  //       }
  //     },
  //     {
  //       path: 'shuyaoDataStatistic',
  //       component: () => import('@/views/loanApps/shuyao/shuyaoDataStatistic'),
  //       name: 'shuyaoDataStatistic',
  //       meta: {
  //         title: '数据统计',
  //         roles: ['super']
  //       }
  //     }
  //   ]
  // },
  //         {
  //           path: '/smallWin',
  //           component: () => import('@/views/loanApps/smallWin/index'),
  //           redirect: '/',
  //           alwaysShow: true,
  //           name: 'smallWin',
  //           meta: {
  //             title: '小赢',
  //             icon: 'fullscreen',
  //             roles: ['super']
  //           },
  //           children: [
  //             {
  //               path: 'smallWinUser',
  //               component: () => import('@/views/loanApps/smallWin/smallWinUser'),
  //               name: 'smallWinUser',
  //               meta: {
  //                 title: '用户列表',
  //                 roles: ['super']
  //               }
  //             },
  //             {
  //               path: 'smallWinReview',
  //               component: () => import('@/views/loanApps/smallWin/smallWinReview'),
  //               name: 'smallWinReview',
  //               meta: {
  //                 title: '授信列表',
  //                 roles: ['super']
  //               }
  //             },
  //             {
  //               path: 'smallWinPushUser',
  //               component: () => import('@/views/loanApps/smallWin/smallWinPush'),
  //               name: 'smallWinPushUser',
  //               meta: {
  //                 title: '推送列表',
  //                 roles: ['super']
  //               }
  //             },
  //             {
  //               path: 'smallWinLoan',
  //               component: () => import('@/views/loanApps/smallWin/smallWinLoan'),
  //               name: 'smallWinLoan',
  //               meta: {
  //                 title: '放款列表',
  //                 roles: ['super']
  //               }
  //             },
  //             {
  //               path: 'smallWinDataStatistic',
  //               component: () => import('@/views/loanApps/smallWin/smallWinDataStatistic'),
  //               name: 'smallWinDataStatistic',
  //               meta: {
  //                 title: '数据统计',
  //                 roles: ['super']
  //               }
  //             }
  //           ]
  //         }
  //       ]
  //     }
  //   ]
  // },
  // 贷超
  {
    path: '/loanapp',
    component: Layout,
    redirect: '/',
    alwaysShow: true, // will always show the root menu
    name: 'chanloanappnel',
    meta: {
      title: '贷超管理',
      icon: 'daichao',
      roles: ['super', 'admin', 'guest', 'yunying'] // you can set roles in root nav
    },
    children: [
      {
        path: 'Loanlist',
        component: () => import('@/views/loanapp/list'),
        name: 'Loanlist',
        meta: {
          title: '贷超列表',
          roles: ['super', 'admin', 'guest', 'yunying']
        }
      },
      // {
      //   path: 'loanLabelFindAll',
      //   component: () => import('@/views/loanapp/labellistss'),
      //   name: 'loanLabelFindAll',
      //   meta: {
      //     title: '标签列表',
      //     roles: ['super', 'admin', 'guest', 'yunying']
      //   }
      // },
      {
        path: 'deploy',
        component: () => import('@/views/loanapp/deploy'),
        name: 'deploy',
        meta: {
          title: '地区成功产品',
          roles: ['super', 'admin', 'guest', 'yunying']
        }
      },
      {
        path: 'vipProduct',
        component: () => import('@/views/loanapp/vipProduct'),
        name: 'vipProduct',
        meta: {
          title: '权益配置',
          roles: ['super', 'admin', 'guest', 'yunying']
        }
      },
      {
        path: 'Channelapplist',
        component: () => import('@/views/loanapp/channelapplist'),
        name: 'Channelapplist',
        meta: {
          title: '贷超配置',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'LoanAppRegion',
        component: () => import('@/views/loanapp/loanAppRegion'),
        name: 'LoanAppRegion',
        meta: {
          title: '区域屏蔽配置',
          roles: ['super', 'admin', 'guest', 'yunying']
        }
      },
      {
        path: 'AppCount',
        component: () => import('@/views/loanapp/appcount'),
        name: 'AppCount',
        meta: {
          title: '贷超统计列表',
          roles: ['super', 'admin', 'guest', 'yunying']
        }
      },
      {
        path: 'everydayCount',
        component: () => import('@/views/loanapp/everydayCount'),
        name: 'everydayCount',
        meta: {
          title: '贷超渠道每日统计列表',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'ChannelCount',
        component: () => import('@/views/loanapp/channelcount'),
        name: 'ChannelCount',
        meta: {
          title: '贷超渠道统计列表',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'firstRuleList',
        component: () => import('@/views/firstRule/firstRule'),
        name: 'firstRuleList',
        meta: {
          title: '前筛规则',
          roles: ['super']
        }
      }
    ]
  },
  {
    path: '/loanswitch',
    component: Layout,
    redirect: '/',
    alwaysShow: true, // will always show the root menu
    name: 'loanswitch',
    meta: {
      title: '广告管理',
      icon: 'channel',
      roles: ['super', 'admin', 'guest'] // you can set roles in root nav
    },
    children: [
      {
        path: 'adaccount',
        component: () => import('@/views/advertising/account'),
        name: 'adaccount',
        meta: {
          title: '广告账户',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'advertisingPlan',
        component: () => import('@/views/advertising/plan'),
        name: 'advertisingPlan',
        meta: {
          title: '广告计划',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'insuranceProducts',
        component: () => import('@/views/advertising/insuranceProducts'),
        name: 'insuranceProducts',
        meta: {
          title: '保险产品',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'insurancePlan',
        component: () => import('@/views/advertising/insurancePlan'),
        name: 'insurancePlan',
        meta: {
          title: '保险计划',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'adRisk',
        component: () => import('@/views/advertising/adRisk'),
        name: 'adRisk',
        meta: {
          title: '广告风控',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'clueLog',
        component: () => import('@/views/advertising/clueLog'),
        name: 'clueLog',
        meta: {
          title: '线索日志',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'riskClueList',
        component: () => import('@/views/advertising/riskClueList'),
        name: 'riskClueList',
        meta: {
          title: '风控线索',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'authApi',
        component: () => import('@/views/advertising/authApi'),
        name: 'authApi',
        meta: {
          title: '授信API',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'allSendMessage',
        component: () => import('@/views/advertising/allSendMessage'),
        name: 'allSendMessage',
        meta: {
          title: '全部线索',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'sendMessage',
        component: () => import('@/views/advertising/sendMessage'),
        name: 'sendMessage',
        meta: {
          title: '线索分发',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'sumInto',
        component: () => import('@/views/advertising/sumInto'),
        name: 'sumInto',
        meta: {
          title: '今日进件数统计',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'historySumInto',
        component: () => import('@/views/advertising/historySumInto'),
        name: 'historySumInto',
        meta: {
          title: '历史进件数统计',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'historyCityCount',
        component: () => import('@/views/advertising/historyCityCount'),
        name: 'historyCityCount',
        meta: {
          title: '城市进件数统计',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'institutionSumInto',
        component: () => import('@/views/advertising/institutionSumInto'),
        name: 'institutionSumInto',
        meta: {
          title: '机构进件数统计',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'weight',
        component: () => import('@/views/advertising/weight'),
        name: 'weight',
        meta: {
          title: '权重配比',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'zdPush',
        component: () => import('@/views/advertising/zdPush'),
        name: 'zdPush',
        meta: {
          title: '线索推送',
          roles: ['super', 'admin', 'guest']
        }
      }
    ]
  },
  // 数据中台
  // {
  //   path: '/pushdata',
  //   component: Layout,
  //   redirect: '/',
  //   alwaysShow: true, // will always show the root menu
  //   name: 'pushdata',
  //   meta: {
  //     title: '数据中台',
  //     icon: 'shujuzhongtai',
  //     roles: ['super', 'admin'] // you can set roles in root nav
  //   },
  //   children: [
  //     {
  //       path: 'PushList',
  //       component: () => import('@/views/phoneUser/pushData'),
  //       name: 'PushList',
  //       meta: {
  //         title: '数据推送列表',
  //         roles: ['super', 'admin']
  //       }
  //     },
  //     {
  //       path: 'PushReport',
  //       component: () => import('@/views/phoneUser/pushReport'),
  //       name: 'PushReport',
  //       meta: {
  //         title: '数据推送报表',
  //         roles: ['super', 'admin']
  //       }
  //     },
  //     {
  //       path: 'PushListconf',
  //       component: () => import('@/views/phoneUser/pushDataconf'),
  //       name: 'PushListconf',
  //       meta: {
  //         title: '数据推送配置',
  //         roles: ['super', 'admin']
  //       }
  //     }
  //   ]
  // },
  // VIP管理
  // {
  //   path: '/sysConfig',
  //   component: Layout,
  //   redirect: '/',
  //   alwaysShow: true, // will always show the root menu
  //   name: 'sysConfig',
  //   meta: {
  //     title: 'VIP管理',
  //     icon: 'vip',
  //     roles: ['super'] // you can set roles in root nav
  //   },
  //   children: [
  //     {
  //       path: 'VipCon',
  //       component: () => import('@/views/sys/vip'),
  //       name: 'VipCon',
  //       meta: {
  //         title: 'Vip配置',
  //         roles: ['super', 'admin']
  //       }
  //     },
  // {
  //   path: 'alipay',
  //   component: () => import('@/views/sys/alipay'),
  //   name: 'alipay',
  //   meta: {
  //     title: '支付宝列表',
  //     roles: ['super']
  //   }
  // }
  //   ]
  // },
  // 电销
  // {
  //   path: '/telesales',
  //   component: Layout,
  //   redirect: '/',
  //   alwaysShow: true,
  //   name: 'telesales',
  //   meta: {
  //     title: '电销管理',
  //     icon: 'electricShop',
  //     roles: ['super']
  //   },
  //   children: [
  //     {
  //       path: 'telesalesLoan',
  //       component: () => import('@/views/telesales/telesalesLoan'),
  //       name: 'telesalesLoan',
  //       meta: {
  //         title: '用户列表-三方贷款',
  //         roles: ['super']
  //       }
  //     },
  //     {
  //       path: 'telesalesAuth',
  //       component: () => import('@/views/telesales/telesalesAuth'),
  //       name: 'telesalesAuth',
  //       meta: {
  //         title: '用户列表-认证',
  //         roles: ['super']
  //       }
  //     },
  //     {
  //       path: 'telesalesOrderLoan',
  //       component: () => import('@/views/telesales/telesalesOrderLoan'),
  //       name: 'telesalesOrderLoan',
  //       meta: {
  //         title: '订单列表-三方贷款',
  //         roles: ['super']
  //       }
  //     },
  //     {
  //       path: 'telesalesOrderAuth',
  //       component: () => import('@/views/telesales/telesalesOrderAuth'),
  //       name: 'telesalesOrderAuth',
  //       meta: {
  //         title: '订单列表-认证',
  //         roles: ['super']
  //       }
  //     }
  //   ]
  // },
  {
    path: '/auth',
    component: Layout,
    redirect: '/',
    alwaysShow: true,
    name: 'auth',
    meta: {
      title: '授信管理',
      icon: 'push',
      roles: ['super', 'admin', 'guest']
    },
    children: [
      {
        path: 'authStatistics',
        component: () => import('@/views/auth/authStatistics'),
        name: 'authStatistics',
        meta: {
          title: '前置授信API统计',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'apiStatistics',
        component: () => import('@/views/auth/apiStatistics'),
        name: 'apiStatistics',
        meta: {
          title: 'API进件统计',
          roles: ['super', 'admin', 'guest']
        }
      }
    ]
  },
  // 渠道管理
  {
    path: '/channel',
    component: Layout,
    redirect: '/',
    alwaysShow: true, // will always show the root menu
    name: 'channel',
    meta: {
      title: '渠道管理',
      icon: 'channel',
      roles: ['super', 'admin', 'guest'] // you can set roles in root nav
    },
    children: [
      {
        path: 'Channellist',
        component: () => import('@/views/channel/channel'),
        name: 'Channellist',
        meta: {
          title: '渠道配置',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'Phonelist',
        component: () => import('@/views/channel/phone'),
        name: 'Phonelist',
        meta: {
          title: '设备信息',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'AppCountChannel',
        component: () => import('@/views/channel/appcount'),
        name: 'AppCountChannel',
        meta: {
          title: '应用统计',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'newappcount',
        component: () => import('@/views/channel/newappcount'),
        name: 'newappcount',
        meta: {
          title: '新版应用统计',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'channelManage',
        component: () => import('@/views/channel/channelManage'),
        name: 'channelManage',
        meta: {
          title: '跑A渠道配置',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'channelExamine',
        component: () => import('@/views/channel/channelExamine'),
        name: 'channelExamine',
        meta: {
          title: '运营跑A渠道查询',
          roles: ['super', 'admin', 'guest']
        }
      }
    ]
  },
  // 用户管理
  {
    path: '/phoneUser',
    component: Layout,
    redirect: '/',
    alwaysShow: true, // will always show the root menu
    name: 'phoneUser',
    meta: {
      title: '用户管理',
      icon: 'user',
      roles: ['super', 'admin'] // you can set roles in root nav
    },
    children: [
      {
        path: 'deleteUser',
        component: () => import('@/views/phoneUser/deleteUser'),
        name: 'deleteUser',
        meta: {
          title: '用户注销',
          roles: ['super', 'admin']
        }
      },
      {
        path: 'PhoneUserindex',
        component: () => import('@/views/phoneUser/phoneUserindex'),
        name: 'PhoneUserindex',
        meta: {
          title: '用户列表',
          roles: ['super', 'admin']
        }
      },
      {
        path: 'authlist',
        component: () => import('@/views/phoneUser/authlist'),
        name: 'Authlist',
        meta: {
          title: '用户筛选列表',
          roles: ['super', 'admin']
        }
      },
      {
        path: 'blackList',
        component: () => import('@/views/phoneUser/blackList'),
        name: 'blackList',
        meta: {
          title: '手机黑名单记录',
          roles: ['super', 'admin']
        }
      },
      {
        path: 'blackListIp',
        component: () => import('@/views/phoneUser/blackListIp'),
        name: 'blackListIp',
        meta: {
          title: 'ip黑名单记录',
          roles: ['super', 'admin']
        }
      },
      {
        path: 'phoneQueryChannel',
        component: () => import('@/views/phoneUser/phoneQueryChannel'),
        name: 'phoneQueryChannel',
        meta: {
          title: '渠道查询',
          roles: ['super', 'admin', 'guest']
        }
      },
    ]
  },

  // 客服反馈
  {
    path: '/service',
    component: Layout,
    redirect: '/',
    alwaysShow: true, // will always show the root menu
    name: 'service',
    meta: {
      title: '客服反馈',
      icon: 'service',
      roles: ['super', 'admin', 'guest'] // you can set roles in root nav
    },
    children: [
      {
        path: 'Service',
        component: () => import('@/views/service/service'),
        name: 'Service',
        meta: {
          title: '客户记录',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'newFeedback',
        component: () => import('@/views/service/newService'),
        name: 'newFeedback',
        meta: {
          title: '新版客户记录',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'urlProb',
        component: () => import('@/views/service/urlProb'),
        name: 'urlProb',
        meta: {
          title: '常见问题',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'configure',
        component: () => import('@/views/service/configure'),
        name: 'configure',
        meta: {
          title: '客服电话配置',
          roles: ['super', 'admin', 'guest']
        }
      }
    ]
  },
  // 推送管理
  {
    path: '/push',
    component: Layout,
    redirect: '/',
    alwaysShow: true,
    name: 'push',
    meta: {
      title: '推送管理',
      icon: 'push',
      roles: ['super', 'admin', 'guest']
    },
    children: [
      {
        path: 'Push',
        component: () => import('@/views/push/push'),
        name: 'Push',
        meta: {
          title: '消息列表',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'pushTiming',
        component: () => import('@/views/push/pushClock'),
        name: 'pushTiming',
        meta: {
          title: '定时任务列表',
          roles: ['super', 'admin', 'guest']
        }
      }
    ]
  },
  // 系统配置
  {
    path: '/systemConfig',
    component: Layout,
    redirect: '/',
    alwaysShow: true, // will always show the root menu
    name: 'systemConfig',
    meta: {
      title: '系统配置',
      icon: 'sysConf',
      roles: ['super', 'admin'] // you can set roles in root nav
    },
    children: [
      {
        path: 'Sysdict',
        component: () => import('@/views/sys/dict'),
        name: 'sysdict',
        meta: {
          title: '字典配置',
          roles: ['super']
        }
      },
      // {
      //   path: 'Sysdict',
      //   component: () => import('@/views/sys/dict'),
      //   name: 'Sysdict',
      //   meta: {
      //     title: '系统配置',
      //     roles: ['super']
      //   }
      // },
      {
        path: 'ApiSeeting',
        component: () => import('@/views/sys/interface'),
        name: 'ApiSeeting',
        meta: {
          title: '接口配置',
          roles: ['super']
        }
      },
      {
        path: 'Agreement',
        component: () => import('@/views/sys/agreement'),
        name: 'Agreement',
        meta: {
          title: '协议管理',
          roles: ['super']
        }
      },
      {
        path: 'SysApiKey',
        component: () => import('@/views/sys/sysapikey'),
        name: 'SysApiKey',
        meta: {
          title: '密钥管理',
          roles: ['super', 'admin', 'guest']
        }
      },
      {
        path: 'Sysapkupload',
        component: () => import('@/views/sys/apkupload'),
        name: 'Sysapkupload',
        meta: {
          title: '应用上传',
          roles: ['super']
        }
      }
    ]
  },
  // 权限
  {
    path: '/permission',
    component: Layout,
    redirect: '/',
    alwaysShow: true, // will always show the root menu
    name: 'Permission',
    meta: {
      title: '权限管理',
      icon: 'lock',
      roles: ['super'] // you can set roles in root nav
    },
    children: [
      {
        path: 'RolePermission',
        component: () => import('@/views/backUser/role'),
        name: 'RolePermission',
        meta: {
          title: '角色',
          roles: ['super']
        }
      },
      {
        path: 'BackUserindex',
        // component: () => import('@/views/backUser/role/index'),
        component: () => import('@/views/backUser/backUserindex'),
        name: 'BackUserindex',
        // redirect: '/backUser/role/sanji/ceshi',
        meta: {
          title: '管理员',
          // icon: 'lock',
          roles: ['super']
        }
        // children: [
        //   {
        //     path: 'ceshi',
        //     component: () => import('@/views/backUser/role/sanji/ceshi'),
        //     name: 'ceshi',
        //     meta: {
        //       title: '测试',
        //       roles: ['super']
        //     }
        //   }, {
        //     path: 'ceshi',
        //     component: () => import('@/views/backUser/role/sanji/ceshi'),
        //     name: 'ceshi',
        //     meta: {
        //       title: '测试',
        //       roles: ['super']
        //     }
        //   }
        // ]
      }
    ]
  },

  // {
  //   path: '/firstRule',
  //   component: Layout,
  //   redirect: '/',
  //   alwaysShow: true,
  //   name: 'firstRule',
  //   meta: {
  //     title: '前筛规则',
  //     icon: 'fullscreen',
  //     roles: ['super']
  //   },
  //   children: [

  //   ]
  // },
  {
    path: '/account',
    component: Layout,
    redirect: '/',
    alwaysShow: true, // will always show the root menu
    name: 'account',
    meta: {
      title: '曝光账户',
      icon: 'electricShop',
      roles: ['super'] // you can set roles in root nav
    },
    children: [
      {
        path: 'accountExposure',
        component: () => import('@/views/account/accountExposure'),
        name: 'accountExposure',
        meta: {
          title: '曝光账户',
          roles: ['super']
        }
      },
      {
        path: 'accountDetail',
        component: () => import('@/views/account/accountDetail'),
        name: 'accountDetail',
        meta: {
          title: '曝光明细',
          roles: ['super']
        }
      }
    ]
  },
  {
    path: '/uinteList',
    component: Layout,
    redirect: '/',
    alwaysShow: true, // will always show the root menu
    name: 'uinteList',
    meta: {
      title: '联登配置',
      icon: 'star',
      roles: ['super'] // you can set roles in root nav
    },
    children: [
      {
        path: 'uinteBuy',
        component: () => import('@/views/service/buy'),
        name: 'uinteBuy',
        meta: {
          title: '买量',
          roles: ['super']
        }
      },
      {
        path: 'uniteSale',
        component: () => import('@/views/service/sale'),
        name: 'uniteSale',
        meta: {
          title: '卖量',
          roles: ['super']
        }
      }
    ]
  },
  {
    path: '/warningConfig',
    component: Layout,
    redirect: '/',
    alwaysShow: true, // will always show the root menu
    name: 'warningConfig',
    meta: {
      title: '数据预警管理',
      icon: 'star',
      roles: ['super'] // you can set roles in root nav
    },
    children: [
      {
        path: 'warningList',
        component: () => import('@/views/sys/warningList'),
        name: 'warningList',
        meta: {
          title: '预警配置',
          roles: ['super']
        }
      },
      {
        path: 'recordList',
        component: () => import('@/views/sys/warningReportList'),
        name: 'recordList',
        meta: {
          title: '报警记录列表',
          roles: ['super']
        }
      }
    ]
  },
  {
    path: '/businessReport',
    component: Layout,
    redirect: '/',
    alwaysShow: true, // will always show the root menu
    name: 'businessReport',
    meta: {
      title: '业务报表',
      icon: 'shujuzhongtai',
      roles: ['super'] // you can set roles in root nav
    },
    children: [
      {
        path: 'channelRevenue',
        component: () => import('@/views/auth/channelRevenue'),
        name: 'channelRevenue',
        meta: {
          title: '渠道营收',
          roles: ['super']
        }
      },
      {
        path: 'channelRoi',
        component: () => import('@/views/auth/channelRoi'),
        name: 'channelRoi',
        meta: {
          title: '渠道ROI统计',
          roles: ['super', 'admin', 'guest']
        }
      }
    ]
  },

  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
];

const createRouter = () =>
  new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
  });

const router = createRouter();

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter();
  router.matcher = newRouter.matcher; // reset router
}

export default router;
